package main
import (
	"fmt"
	"time"
)

func main() {
	start := time.Now()
	var a, b, c int = 1, 1, 1
	found := false
	for a = 1; a < 998 && found == false; a++ {
		for b = 1; b < 998 && found == false; b++ {
			for c = 1; c < 998 && found == false; c++ {
				if isTriplet(a, b, c) && sum1k(a, b, c) {
					fmt.Printf("a = %v, b = %v, c = %v\n", a, b, c)
					fmt.Println("Product abc = ", a * b * c)
					found = true
				}
			}
		}

	}
	stop := time.Now()
	fmt.Println("Execution time:", stop.Sub(start))

}

func isTriplet(a, b, c int) bool {
	if (a * a) + (b * b) == (c * c) {
		return true
	}
	return false
}

func sum1k(a, b, c int) bool {
	if a + b + c == 1000 {
		return true
	}
	return false
}
